package Weapons;

import game.Config.BulletFactory;

import org.newdawn.slick.geom.Vector2f;
/**
 * This class represents a Ricochetgun in the game. The ricochetgun
 * extends weapon and can be fired.
 * When fired, the ricochetgun will spawn bullets that bounce
 * between targets.
 * @author Sebastian Isheden and Victor Beer
 */
public class RicochetGun extends Weapon{
	float bounceRadius;
	int maximumTargets;
	/**
	 * @param fireRate	The amount of times this weapon can fire per second.
	 * @param damage  The damage per shot of this weapon.
	 * @param bulletSpeed  The speed the fired bullets will traverse the screen.
	 * @param bounceRadius The distance that the spawned bullets will be able to bounce between targets.
	 * @param maximumTargets  The maximum amount of targets that can be hit.
	 */
	public RicochetGun(float fireRate, float damage, float bulletSpeed,float bounceRadius,int maximumTargets) {
		super(fireRate, damage, bulletSpeed);
		this.bounceRadius = bounceRadius;
		this.maximumTargets = maximumTargets;
	}
	/**
	 * Returns a copy of the ricochetgun.
	 */
	@Override
	public Weapon copy() {
		return new RicochetGun(1/this.fireInterval,this.damage,this.bulletSpeed,this.bounceRadius,this.maximumTargets);
		}

	@Override
	protected void spawnBullet(Vector2f position, Vector2f direction) {
		callFactory(position,direction);
		
	}

	@Override
	protected void callFactory(Vector2f position, Vector2f direction) {
		BulletFactory.createRicochetBullet(this.damage, this.bulletSpeed, position, direction, this.bounceRadius, this.maximumTargets);
	}

}
